home *** CD-ROM | disk | FTP | other *** search
/ PC Zone 86 / PC Zone #086.7z / Dppcz0200.mdf / Editor.ial / Messiah / messiahpatch.exe / data1.cab / Program_Executable_Files / messiahscripts / Enemies / DomGen.hxx < prev    next >
Text File  |  1999-11-28  |  18KB  |  727 lines

  1.  
  2.         float(_declare,ShootDelayCounter,0)
  3.         float(_declare,JumpIdleCounter,0);
  4.         float(_declare,JumpPressCounter,0);
  5.         float(_declare,DownwardPull,0);
  6.         float(_declare,TurnSpeed,0);
  7.         float(_declare,ColAngleCorrectNeeded,0);
  8.         float(_declare,ForceRunFrames,0);
  9.         float(_declare,AirSpeedForward,0);
  10.         float(_declare,AirSpeedSideways,0);
  11.         float(_declare,FallStartAltitude,0);
  12.         float(_declare,SmokeCount,1000);
  13.         float(_declare,FireCount,0);
  14.         float(_declare,ActionOK,1);
  15.         float(_declare,KeyPressCounter,0);
  16.         float(_declare,DropDelay,100);
  17.         float(_declare,ActorDeathType_f,0);
  18.         float(_declare,SteamCounter,0);
  19.  
  20.         vector(_declare,WeaponPickUpPos,0,0,0);
  21.  
  22.  
  23.         if(VAICon==0 && vstate==statedead)
  24.         {
  25.             message("YOU CALL YOURSELF THE MESSIAH?",400,10);
  26.             call(ChangeSniperMode,0,0);
  27.         }
  28.  
  29.         if(VActiveTime==0)
  30.         {
  31.             call(CheckForPickup,12,_ClassWeapon);
  32.  
  33.             vector(_settoactorpos,TmpVector);
  34.             vector(_copyy,TmpVector,FallStartAltitude);
  35.         }
  36.  
  37.         callsub(Sub_SqueezeCheck,Prost1Crush);
  38.  
  39.         if(VState==StateDead)
  40.         {
  41.             direction(_clr,_DIRcombatmode);
  42.             Direction(_clr,_DIRaiRemoveFlags);
  43.         }
  44.         elseif(vAICon!=0 && aitoggle==0)
  45.         {
  46. // **************************************************************************
  47. // **************************************************************************
  48. // **************************************************************************
  49.  
  50.                 //AIPickDest(100,1);
  51.  
  52.                 Direction(_clr,_DIRaiRemoveFlags)
  53.  
  54.                 if(VTrigger!=_DIRHaveGun)
  55.                 {
  56.                     call(IsPickupClose,_ClassWeapon,90,TmpFloat,TmpVector);
  57.                     if(vtrigger==_DIRTempFlag && TmpFloat!=0)
  58.                     {
  59.                         Direction(_set,_DIRaction);
  60.                         //float(_set,ActionOK,1);
  61.                         //direction(_clr,_DIRactionhold);
  62.                     }
  63.                 }
  64.  
  65. /*                float(_declare,shootcounter,0);
  66.                 if(vlockedondistance>30 && vaistate!=_aistateidle)
  67.                 {
  68.                     if(vlockedonangle<-20)
  69.                     {
  70.                         turn(0,-19,0);
  71.                         //Direction(_set,_DIRleft);
  72.                     }
  73.                     elseif(vlockedonangle>20)
  74.                     {
  75.                         turn(0,19,0);
  76.                         //Direction(_set,_DIRright);
  77.                     }
  78.  
  79.  
  80.                     if(vtargetdistance>600)
  81.                     {
  82.                         //if(vlockedonangle<50 && vlockedonangle>-50)
  83.                         //{
  84.                             if(vlockedonangle<20 && vlockedonangle>-20)
  85.                             {
  86.                                 Direction(_set,_dirrun);
  87.                                 if(vstate==statenormal && vtargetdistance>1000 && vtargetdistance<1500 && vrnd<5)
  88.                                 {
  89.                     //                Direction(_set,_DIRGrenade);
  90.                                 }
  91.                             }
  92.                         //}
  93.                     }
  94.                     else
  95.                     {
  96.                         if(vtargetdistance>100 && vlockedonangle<90 && vlockedonangle>-90)
  97.                         {
  98.                             //if(vlockedondistance<300)
  99.                             if(vtrigger==_DIRhavegun)
  100.                             {
  101.                                 if(vrnd<10 || shootcounter!=0)
  102.                                 {
  103.                                     Direction(_set,_DIRshoot);
  104.                                     float(_add,shootcounter,1);
  105.                                     if(shootcounter>60)
  106.                                     {
  107.                                         Direction(_clr,_DIRshoot);
  108.                                         float(_set,shootcounter,0);
  109.                                     }
  110.                                 }
  111.                             }
  112.                             else
  113.                             {
  114.                                 Direction(_clr,_DIRshoot);
  115.                             }
  116.                     
  117.                             Direction(_set,_DIRforward|_DIRwalking);
  118.                         }
  119.                     }
  120.  
  121.                 }
  122. */
  123.  
  124.                 if(vtrigger==_DIRvercol && vstate!=StateJump)
  125.                 {
  126.                     Collision(0,-20,0, 0,-20,-130);
  127.                     if(vcolflag==_DIRvercol)
  128.                     {
  129.                         Collision(0,60,0, 0,60,-130);
  130.                         if(vcolflag!=_DIRvercol)
  131.                         {
  132.                             Direction(_set,_DIRjump);
  133.                         }
  134.                     }
  135.                 }
  136.                 elseif(vstate==StateJump)
  137.                 {
  138.                     Direction(_set,_DIRjump);
  139.                 }
  140.  
  141.                 if(VTrigger|=_DIRMoveBits)
  142.                 {
  143.                     Direction(_set,_DIRMove)
  144.                 }
  145.  
  146. // **************************************************************************
  147. // **************************************************************************
  148. // **************************************************************************
  149.  
  150.         }
  151.         else
  152.         {
  153. //Player control
  154.             callsub(Sub_CombatKeyHandler,KeyPressCounter,10);
  155.             
  156.             if(vtrigger==_DIRpossesion)
  157.             {
  158.                 float(_set,PlayerHeadBone,4);
  159.                 callsub(Sub_InitPossesion,DomPossesed);
  160.             }
  161.             elseif(vtrigger==_DIRdepossesion)
  162.             {
  163.                 callsub(Sub_InitDepossesion,DomDepossesed)
  164.             }
  165.         }
  166.  
  167.  
  168.  
  169.         if(vstate!=StateDead)
  170.         {
  171.             callSub(Sub_ActionKeyHandler,ActionOK);
  172.             if(vstate==StateNormal && vtrigger!=_DIRhavegun)
  173.             {
  174.                 if(VState==StateCrouching)
  175.                 {
  176.                     callSub(Sub_CheckActionPickup,DomPickupCrouch,12,0,0);
  177.                 }
  178.                 else
  179.                 {
  180.                     callSub(Sub_CheckActionPickup,DomPickup,14,0,0);
  181.                 }
  182.                 callsub(BackGroundTriggerChecks);
  183.             }
  184.             else
  185.             {
  186.                 callsub(BackGroundTriggerChecks);
  187.                 if(vstate==StateNormal)
  188.                 {
  189.                     if(VState==StateCrouching)
  190.                     {
  191.                         callSub(Sub_CheckActionDrop,DomPickupCrouch,12,0,0,DropDelay);
  192.                     }
  193.                     else
  194.                     {
  195.                         callSub(Sub_CheckActionDrop,DomPickup,14,0,0,DropDelay);
  196.                     }
  197.                 }
  198.             }
  199.             if (vtrigger!=_DIRhavegun)
  200.             {
  201.                 callSub(Sub_CheckRemainingActions,DomPressGun,22);
  202.             }
  203.             else
  204.             {
  205.                 callSub(Sub_CheckRemainingActions,DomPressGun,22);
  206.             }
  207.  
  208.             callsub(Sub_Headtrack);                    //Track head against object
  209.  
  210.  
  211.             if(VState==StateThrown)
  212.             {
  213.                 CallSub(Sub_CheckThrownFallDamage,FallStartAltitude,Prost1MaxFall);
  214.                 if(VState==StateNormal)
  215.                 {
  216.                     callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeedWounded,DomTurnAccWounded);
  217.                 }
  218.             }
  219.             elseif(VState!=StateElectricShock)
  220.             {
  221.                 CallSub(Sub_CheckFallDamage,DomTouchDown,FallStartAltitude,DomMaxFall,DamageDomFall,DomFallDead,0,DomFallInplace);
  222.             }
  223.         }
  224.         callsub(Sub_CheckHit,DomWoundLight,DomWoundLight,DomWoundLightNoBreak,FireCount,DomPoleDead,DomWoundLight,0,0,0,0);
  225.  
  226.         if(vstate==StateOnFire)    //These first if-statements are just for effects
  227.         {
  228.             if(vrnd<20)
  229.             {
  230.                 CheckActorCollision(0,emptyVector,96,0,_COLfire,DamageFlameThrower);
  231.             }
  232.  
  233.             if(FireCount==0)
  234.             {
  235.                 sample(SFXActorOnFire1,-1);
  236.                 samplestop(SFXcough7);
  237.  
  238.                 float(_rnd2,ActorFireType,70);
  239.                 float(_set,ActorDeathType_f,1);
  240.             }
  241.             callsub(Sub_ActorFireEffect,SmokeCount,FireCount,255)
  242.         }
  243.         elseif(vstate==StateBlind)
  244.         {
  245.             if(SmokeCount==0)
  246.             {
  247.                 float(_set,FireCount,0);
  248.                 samplestop(SFXActorOnFire1);
  249.                 sample(SFXcough7,-1);
  250.             }
  251.             callsub(Sub_ActorSmokeEffect,SmokeCount,255)
  252.  
  253.             if(vstate!=StateDead && ActorDeathType_f==1)
  254.             {
  255.                 //actor will die as he's been roasted
  256.                 call(SubtractHealth,0,DamageAfterFire);
  257.             }
  258.         }
  259.  
  260.  
  261.         if(VAction!=DomBurningRunInCircle&&VAction!=DomBurningRollOnFloor&&VAction!=DomSlowGetUpFace)    //It would look bad if he died while in one of these animations
  262.         {
  263. //The last number here is used if they have to fall on their knees when energy is low
  264.             callsub(Sub_CheckDeadOrDying,DomPoleDead,DomCrawlDead,DomStandDead,DomCrawlSpread,500,DomFallToCrawl,DomStandDead,DomStandDead);    //0=health when entering crawling-mode
  265.         }
  266.  
  267.         if(vstate==StateExecuteAnim)
  268.         {
  269. /*ttt            if(vaction==DomThrowGrenade)
  270.             {
  271.                 if(vendofanim!=0)
  272.                 {
  273.                     callsub(Sub_SpawnGrenade);
  274.                 }
  275.                 callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeed,DomTurnAcc);
  276.             }
  277. */
  278.             elseif(vaction==DomPossesed)
  279.             {
  280.                 callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeed,DomTurnAcc);
  281.             }
  282.             elseif(vaction==DomPickup)
  283.             {
  284.               //callSub(Sub_CheckActionButton,CopPickup,14)
  285.             }
  286. //CopClimbUp, CopDepossesed, CopPickup/Throw weapon,
  287.             callsub(Sub_CheckExecuteAnimEnd)
  288.         }
  289.         elseif(vstate==StateDead||vstate==StateCrawling||vstate==StateBlind||vstate==StateOnFire||vstate==StateSteamed||vstate==StateHarpooned||vstate==StateElectricShock)
  290.         {
  291.             direction(_clr,_DIRcombatmode);
  292.  
  293.             if(VState!=StateDead)
  294.             {
  295.                 if(vstate==StateHarpooned)    //Here are the if-statements that control the actions when you are badly wounded
  296.                 {
  297.                     callsub(Sub_Harpooned,DomOnPole,DomOnPole,DomOnPole,DomOnPole,DomOnPole,DomOnPole,0,0);
  298.                 }
  299.                 else
  300.                 {
  301.                     callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeedWounded,DomTurnAccWounded);
  302.                     if(vstate==StateCrawling)
  303.                     {
  304. //    is this where he has to roll over and hug his knees, and scream if you force him to move?
  305. //
  306.                         callsub(Sub_Crawling,DomCrawlSpread,DomFallToCrawl)
  307.                     }
  308.                     elseif(vstate==StateOnFire||vstate==StateSteamed||vstate==StateBlind)
  309.                     {
  310.                         callsub(Sub_BurnedSteamedBlind,DomBurningRollOnFloor,DomBurnedIdle,DomGettingBurned,DomBlindForward,DomBlindBackwards,DomBurningRunInCircle,DomSlowGetUpFace,SteamCounter,GENIdle)
  311.                     }
  312.                     elseif(vstate==StateElectricShock)
  313.                     {
  314.                         callsub(Sub_ElectricShock,Domelectricshock0,Domelectricshock1);
  315.  
  316.                         if(vaction==Domelectricshock0)
  317.                         {
  318.                             if(vframe==1)
  319.                             {
  320.                                 sample(SFXElectricShock1,-1);
  321.                                 call(SubtractHealth,0,DamageElectric);
  322.                             }
  323.                         }
  324.                         elseif(vaction==Domelectricshock1)
  325.                         {
  326.                             if(vendofanim!=0)
  327.                             {
  328.                                 sample(SFXElectricShock2,-1);
  329.  
  330.                                 call(PlaneTriggerQuadrant,TmpFloat,1);
  331.                                 if(TmpFloat==0)
  332.                                 {
  333.                                     spawnaction(DomThrownForward);
  334.                                     move(0,0,-150);
  335.                                 }
  336.                                 elseif(TmpFloat==1)
  337.                                 {
  338.                                     spawnaction(DomThrownLeft);
  339.                                     move(150,0,0);
  340.                                 }
  341.                                 elseif(TmpFloat==2)
  342.                                 {
  343.                                     spawnaction(DomThrownBack);
  344.                                     move(0,0,150);
  345.                                 }
  346.                                 elseif(TmpFloat==3)
  347.                                 {
  348.                                     spawnaction(DomThrownRight);
  349.                                     move(-150,0,0);
  350.                                 }
  351.                                 state(_change,StateElectricShock,StateThrown);
  352.                             }
  353.                         }
  354.                     }
  355.                 }
  356.             }
  357.         }
  358.         else
  359.         {
  360.             CallSub(Sub_CheckClimbUp,DomClimbUp,60,ColAngleCorrectNeeded,20,-10)
  361.  
  362.             if(vstate==StateNormal)
  363.             {
  364.                 callsub(sub_AlignToWallAndCheckRunUpStairs,DomRunUpStairs,DomIdle,DomIdleHitWall,ColAngleCorrectNeeded,DomIdleHitWallFront,DomHitWallSpread,-0.95,DomSpread,DomSpreadGun,ForceRunFrames)
  365.                 callsub(Sub_CheckForIdleLongTime,DomIdle,DomIdleLongTime);
  366.  
  367.                 if(vendofanim!=0)
  368.                 {
  369.                     if(vaction==DomTouchDown)
  370.                     {
  371.                         spawnaction(DomIdle);
  372.                     }
  373.                 }
  374.  
  375.                 if(VTrigger==_DIRGrenade&&VInventoryLeft>0)
  376.                 {
  377.                     state(_or,StateExecuteAnim)
  378.                     if(VState==StateCrouching)
  379.                     {
  380.                         spawnaction(DomCrouchGrenade);
  381.                     }
  382.                     else
  383.                     {
  384.                         spawnaction(DomThrowGrenade);
  385.                     }
  386.                 }
  387.  
  388.                 CallSub(Sub_CheckCrouching,DomCrouchDown,DomCrouchUp);
  389.  
  390.                 CallSub(Sub_CheckJumpFallDown,AIAbility,DomRunUpStairs,JumpPressCounter,DownwardPull,DomJumpSpeed,DomJump,AirSpeedForward,AirSpeedSideways,DomFall,DomAirSpeed)
  391.                 //callSub(Sub_CheckActionButton,CopPickup,14)
  392.                 callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeed,DomTurnAcc);
  393.             }
  394.             elseif(vstate==StateFalling||vstate==StateJump)
  395.             {
  396.                 if(vstate==StateJump)
  397.                 {
  398.                     CallSub(Sub_Jump,JumpPressCounter,DownwardPull,DomMinHoldJumpAction,DomJumpGravity,2,0)
  399.                 }
  400.                 callsub(Sub_TurnCharacter,TurnSpeed,DomMaxTurnSpeedAir,DomTurnAccAir);
  401.                 callsub(Sub_MoveInAir,AirSpeedSideways,AirSpeedForward,DomAirSpeed,DomAirBulb);
  402.             }
  403.         }
  404.         callsub(FireWeaponsAndCheckAttached,ShootDelayCounter,1,CopReload,CopReloadCrouch,DomHeavyRecoil,DomLightRecoil,DomCrouchHeavyRecoil,DomCrouchLightRecoil);
  405.  
  406.  
  407.         if(vaicon!=0 && aitoggle==0)
  408.         {
  409.             call(AIupdateAIvars);
  410.             if(VAIleader!=0)            //in charge
  411.             {
  412.                 print("Im the leader....");
  413.                 call(AIcheckfortarget);
  414.  
  415.                 if(VAIgroupstate!=_AIstateidle && VAIgroupstate!=_AIstatesearch)            //search should be widened to account for all attackstates
  416.                 {
  417.                     printi("In attack....",VAInotargettime);
  418.                     if(VAInotargettime<AINOTARGETTHRESHOLD)
  419.                     {
  420.                         print("Persuing enemy...");
  421.                         call(AIasktojoin,_AIstateAttack);            //to make sure newcomers are asked to join for battle
  422.                         if(VAItargetfound!=_AIenemy && VAInotargettime<AINOTARGETSEARCHTHRESHOLD)
  423.                         {
  424.                             call(AIorder,_AIstateSearch);
  425.                             //sample(SFXOrderSearch,-1);
  426.                         }
  427.     /*                    elseif(VAIgrouphealth<50)
  428.                         {
  429.                             call(AIorder,_AIstateretreat);
  430.                         }
  431.                         elseif(VAIpowerrating>80)        //0=no chance 50=neutral 100=superior
  432.                         {
  433.                             call(AIorder,_AIstatesurround);
  434.                         }
  435.                         elseif(VAIpowerrating<30)        //0=no chance 50=neutral 100=superior
  436.                         {
  437.                             call(AIorder,_AIstatespreadout);
  438.                         }
  439.                         elseif(VAIpowerrating<15)
  440.                         {
  441.                             call(AIorder,_AIstatehide);
  442.                         }
  443.                         elseif(VAIgroupleft<70 || VAItimeincurrentorder>AIINORDERREGROUPTHRESHOLD)            //percentage left of original group
  444.                         {
  445.                             call(AIorder,_AIstateregroup);
  446.                         }
  447.                         else
  448.                         {
  449.                             call(AIorder,_AIstateattack);
  450.                         }
  451.     */
  452.                         if(Vaistate==_AIstateattack)
  453.                         {
  454.                             print("Im leading an attack");
  455.                         }
  456.                         call(AIgrouppickdest);
  457.                     }
  458.                 }
  459.                 else
  460.                 {
  461.                     print("No enemy in sight....");
  462.                     if(VAItargetfound==_AIenemy)        //just saw enemy
  463.                     {
  464.             //            print("I saw you. Changing to attack mode");
  465.                         call(AIselecttarget,_AIenemy);
  466.                         call(AIorder,_AIstateAttack);
  467.                         sample(SFXOrderGetHim,-1);
  468.                     }
  469.                     elseif(VAIlasttargetfound|=_AIenemy)            //continue searching
  470.                     {
  471.             //            print("But there used to be....");
  472.                         if(VAInotargettime>AISTOPIFNOTARGETTHRESHOLD)        //check for release group
  473.                         {
  474.                             call(AIorder,_AIstateAtEase);
  475.                             call(AIreleasegroup);
  476.                             sample(SFXSSGirlAhBaNine,-1);
  477.                         }
  478.                         else
  479.                         {
  480.             //                print("So search for him....");
  481.                             if(vaistate!=_AIstatesearch)
  482.                             {
  483.                                 call(AIorder,_AIstateSearch);
  484.                                 //sample(SFXOrderSearch,-1);
  485.                             }
  486.                         }
  487.                     }
  488.                     else                                    //nothing in sight. no present search
  489.                     {
  490.                         //idle formations here
  491.             //            print("Leader in idle formation");
  492.                         call(AIasktojoin,_AIstateIdle);            //join the idle formation
  493.                         if(VAInringroup<5)
  494.                         {
  495.                             //special formation here
  496.                         }
  497.  
  498.                     }
  499.                 }
  500.             }
  501.             elseif(VAIingroup!=0)        //included in group
  502.             {
  503.                 print("Im assigned to a group....");
  504.  
  505.                 if(VAIstatechanged!=0)
  506.                 {
  507.                     sample(SFXOrderYesSir1,-1);
  508.                 }
  509.  
  510.                 if(VAIaskedtojoin!=0)
  511.                 {
  512.                     printi("And im asked to leave",VAIchangetonewgroup);
  513.                     if(VAIchangetonewgroup!=0)
  514.                     {
  515.                         break();
  516.                         call(AIbreakfromgroup);
  517.                         call(AIjoinnewgroup);
  518.                     }
  519.                 }
  520.                 call(AIPickdest);
  521.  
  522.  
  523.             //    if(Vaistate==_AIattack)
  524.             //    {
  525.             //        print("And in the middle of an attack........");
  526.             //    }
  527.  
  528.     /*            if(VAIrebel!=0)            //want out? (friendly fire, health, members dies, ammunition etc)
  529.                 {
  530.                     break();
  531.                     call(AIbreakfromgroup);
  532.                     if(VAItargetfound==_AIenemy)            //in the middle of battle?
  533.                     {
  534.                         if(VAIhealth<10)
  535.                         {
  536.                             call(AIorder,_AIflee);
  537.                             call(AIasktojoin,_AIRetreat);
  538.                         }
  539.                         elseif(VAIhealth>90)
  540.                         {
  541.                             call(AIorder,_AIAttack);
  542.                             call(AIasktojoin,_AIAttack);
  543.                         }
  544.                         else
  545.                         {
  546.                             call(AIorder,_AIHide);
  547.                             call(AIasktojoin,_AIRetreat);
  548.                         }
  549.                     }
  550.                     else
  551.                     {
  552.                         call(AIorder,_AIIdle);
  553.                     }
  554.                 }
  555.                 elseif(VAIaskedtojoin!=0)
  556.                 {
  557.                     if(VAIchangetonewgroup!=0)
  558.                     {
  559.                         break();
  560.                         call(AIbreakfromgroup);
  561.                         call(AIjoinnewgroup);
  562.                     }
  563.                 }
  564.                 else
  565.                 {
  566.                     call(AIpickdest,100,1);        //execute order
  567.                     if(VAIstate==_AISearch)
  568.                     {
  569.                         call(AIcheckfortarget);
  570.                         if(VAItargetfound==_AIenemy)
  571.                         {
  572.                             call(AIorder,_AIattention);
  573.                         }
  574.                     }
  575.                 }
  576.     */
  577.             }
  578.             else
  579.             {
  580.                 call(AIcheckfortarget);
  581.  
  582.                 print("Im by my self");
  583.  
  584.                 if(VAIaskedtojoin!=0)
  585.                 {
  586.                     print("I was asked to join");
  587.                     if(VAIchangetonewgroup!=0)
  588.                     {
  589.                         print("I joined");
  590.                         call(AIjoinnewgroup);
  591.                         sample(SFXOrderYesSir1,-1);
  592.                     }
  593.                     else
  594.                     {
  595.                         printi("LeaderAspiration: ",VAIleaderaspirations);
  596.                         if(VAIleaderaspirations!=0)
  597.                         {
  598.                             printi("Ask to join new group");
  599.                             call(AIasktojoin,_AIstateAttack);
  600.                             call(AIorder,_AIstateattack);
  601.                             sample(SFXOrderGetHim,-1);
  602.                         }
  603.                     }
  604.                 }
  605.                 else
  606.                 {
  607.                     print("And nobody asked me to join");
  608.                 }
  609.  
  610.                 if(vaistate==_aistateattack)
  611.                 {
  612.  
  613.                     if(VAItargetfound!=0 && VAItargetfound==_AIenemy)
  614.                     {
  615.                         print("InAttack by myself...");
  616.                         call(AIselecttarget,_AIenemy);
  617.                         call(AIPickdest);                //in no group. goes after the guy by himself
  618.                     }
  619.                     else
  620.                     {
  621.                         call(AIorder,_AIstateSearch);
  622.                         //sample(SFXOrderSearch,-1);
  623.                     }
  624.                 }
  625.                 elseif(vaistate==_AIstateSearch)
  626.                 {
  627.                     print("Im searching by myself..");
  628.                     turn(0,10,0);
  629.                     if(VAItimeincurrentorder>AINOTARGETTHRESHOLD)
  630.                     {
  631.                         call(AIorder,_AIstateidle);
  632.                     }
  633.                 }
  634.                 elseif(VAItargetfound!=0)
  635.                 {
  636.                     print("Target found");
  637.                     if(VAItargetfound==_AIenemy)
  638.                     {
  639.                         print("Enemy found...............");
  640.  
  641.                         call(AIorder,_AIstateattack);
  642.                         print("Going into attackmode...");
  643.  
  644.     /*                    if(vaistate!=_aiattention)
  645.                         {
  646.                             call(AIorder,_AIattention);
  647.                             sample(SFXOrderOverThere1,-1);
  648.                         }
  649.     */
  650.                         if(VAIleaderaspirations!=0)
  651.                         {
  652.                             call(AIasktojoin,_AIstateAttack);
  653.                             call(AIorder,_AIstateattack);
  654.                             sample(SFXOrderGetHim,-1);
  655.                         }
  656.  
  657.                     }
  658.                     elseif(VAITargetFound==_AIundetermined)
  659.                     {
  660.                         call(AIorder,_AIstateSearch);
  661.                         //sample(SFXOrderSearch,-1);
  662.                     }
  663.                     else        //friend seen
  664.                     {
  665.                         call(AIasktojoin,_AIstateIdle);
  666.                         print("Friend found.Join me.........");
  667.                     }
  668.                 }
  669.                 else
  670.                 {
  671.                     call(AIorder,_AIstateIdle);
  672.                     //patrol
  673.                     //relax
  674.                     //sleep
  675.                 }
  676.             }
  677.  
  678.             print("..........................");
  679.         }
  680.  
  681.  
  682.  
  683.         if(VAICon==0 && vtrigger==_DIRleft||vtrigger==_DIRright||vtrigger==_DIRforward||vtrigger==_DIRbackward||vtrigger==_DIRsideleft||vtrigger==_DIRsideright)
  684.         {
  685.             if(VSpecialFlag==_sFLAGTrodInGoo)
  686.             {
  687.                 if(vrnd<50)
  688.                 {
  689.                     spawnparticle(fx_footbloodspray,18,emptyvector,emptyvector,-1);
  690.                 }
  691.                 else
  692.                 {
  693.                     spawnparticle(fx_footbloodspray,22,emptyvector,emptyvector,-1);
  694.                 }
  695.                 sample(SFXBlood2,-1);
  696.             }
  697.             else
  698.             {
  699.                 callsub(Sub_CheckFootSteps,_sFLAGLeftFoot);
  700.                 callsub(Sub_CheckFootSteps,_sFLAGRightFoot);
  701.             }
  702.         }
  703.  
  704.  
  705.         //weapons
  706.         if(VAICon==0 && VSpecialFlag==_sFLAGPickedUpGun)
  707.         {
  708.             sample(SFXWeaponPickUp,-1);
  709.         }
  710.  
  711.         if(VAICon==0 && VSpecialFlag==_sFLAGPickedUpAmmo)
  712.         {
  713.             if(vrnd<33)
  714.             {
  715.                 sample(SFXWeaponAmmo1,-1);
  716.             }
  717.             elseif(vrnd<66)
  718.             {
  719.                 sample(SFXWeaponAmmo2,-1);
  720.             }
  721.             else
  722.             {
  723.                 sample(SFXWeaponAmmo3,-1);
  724.             }
  725.         }
  726.  
  727.